home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / MysticSpawner.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  2.5 KB  |  72 lines

  1. public class MysticSpawner extends Codex {
  2.    private String _randomGood1 = "";
  3.    private String _randomGood2 = "";
  4.    private String _randomBad1 = "";
  5.    private String _randomBad2 = "";
  6.    private CodexThing _spawnPoint = new CodexThing(((Codex)this).GetClassThing());
  7.    private CodexThing _particles;
  8.    private int particlesGuid;
  9.    private boolean bStarted;
  10.    private boolean bSpawned;
  11.    public static String[] _params = new String[]{"Random Good 1 (template name)", "Random Good 2 (template name)", "Random Bad 1 (template name)", "Random Bad 2 (template name)"};
  12.  
  13.    public void beginscene(int clientGuid, int captureID) {
  14.       if (!this.bSpawned) {
  15.          if (this.bStarted) {
  16.             this._particles = new CodexThing(this.particlesGuid);
  17.          } else {
  18.             this._particles = new CodexThing(this._spawnPoint.SpawnThing("mysticIdleMagic"));
  19.             this.particlesGuid = this._particles.GetGUID();
  20.             this.bStarted = true;
  21.          }
  22.  
  23.       }
  24.    }
  25.  
  26.    public void restore(int flags) {
  27.       this.bStarted = CodexSequence.RestoreBoolean();
  28.       this.bSpawned = CodexSequence.RestoreBoolean();
  29.       this.particlesGuid = CodexSequence.RestoreInt();
  30.    }
  31.  
  32.    public MysticSpawner(String randomGood1, String randomGood2, String randomBad1, String randomBad2) {
  33.       this._randomGood1 = randomGood1;
  34.       this._randomGood2 = randomGood2;
  35.       this._randomBad1 = randomBad1;
  36.       this._randomBad2 = randomBad2;
  37.    }
  38.  
  39.    void touched(int guid, int toucherGuid, int captureID) {
  40.       if (Codex.IsPlayerGuid(toucherGuid) && !this.bSpawned) {
  41.          this._particles.Remove();
  42.          int nRandom = (int)(Math.random() * (double)4.0F + (double)1.0F);
  43.          switch (nRandom) {
  44.             case 1:
  45.                this._spawnPoint.SpawnThing(this._randomGood1);
  46.                this._spawnPoint.SpawnThing("mysticGoodMagic");
  47.                break;
  48.             case 2:
  49.                this._spawnPoint.SpawnThing(this._randomGood2);
  50.                this._spawnPoint.SpawnThing("mysticGoodMagic");
  51.                break;
  52.             case 3:
  53.                this._spawnPoint.SpawnThing(this._randomBad1);
  54.                this._spawnPoint.SpawnThing("mysticBadMagic");
  55.                break;
  56.             case 4:
  57.                this._spawnPoint.SpawnThing(this._randomBad2);
  58.                this._spawnPoint.SpawnThing("mysticBadMagic");
  59.          }
  60.  
  61.          new CodexSound("teleport_04.wav", 200.0F, 512.0F, 80, 0, 0, guid);
  62.          this.bSpawned = true;
  63.       }
  64.    }
  65.  
  66.    public void save(int flags) {
  67.       CodexSequence.SaveBoolean(this.bStarted);
  68.       CodexSequence.SaveBoolean(this.bSpawned);
  69.       CodexSequence.SaveInt(this.particlesGuid);
  70.    }
  71. }
  72.